﻿using Modules.System.EarlyWarning;
using PmSoft.Quartz;
using Quartz;

namespace ManagementApi.Jobs
{
    /// <summary>
    /// 项目代发预警记录
    /// </summary>
    [DisallowConcurrentExecution]//不可并行执行
    [JobDescription("0 0 00 3 * ?")]//每月3日00:00:00执行一次
    public class ProjectWageWaringThreeHJob : IJob
    {
        private readonly SysEarlyWarningService earlyWarningService;

        public ProjectWageWaringThreeHJob(SysEarlyWarningService earlyWarningService)
        {
            this.earlyWarningService = earlyWarningService;
        }

        public Task Execute(IJobExecutionContext context)
        {
            DateTime month = DateTime.Now.AddMonths(-2);
            #region 查询上上个月项目月报表，代发状态为位落实的数据
            earlyWarningService.CreateSysEarlyWarning(Convert.ToInt32((month).ToString("yyyyMM")), false);
            #endregion

            return Task.CompletedTask;
        }
    }
}
